<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>栏目列表 - Powered By BETOU.NET</title>
<meta name="author" content="BETOU.NET Team" />
<meta name="copyright" content="BETOU.NET" />
<link href="${base}/res/betou/css/common.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/betou/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/res/common/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="${base}/res/common/js/common.js"></script>
<script src="${base}/res/betou/js/list.js" type="text/javascript"></script>
<script type="text/javascript">
$().ready(function() {

	var $listForm = $("#listForm");
	var $priorityButton = $("#priorityButton");
	var $filterSelect = $("#filterSelect");
	var $filterOption = $("#filterOption a");
	// 添加子栏目
	$filterSelect.mouseover(function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	$priorityButton.click( function( ){
		if ($(this).hasClass("disabled")) {
			return false;
		}
		
		$listForm.attr( "action", "o_priority.do");
		$listForm.submit( );
	})
	
	$("input[name*=priority]").focus(function(){
		$(this).select();
	}).blur( function( ){
		var isDisabled = 0;
		$("input[name*=priority]").each( function( i, e ){
			var eachVal = $(this).val();
			if( !/^\d+$/.test( eachVal ) ){
				$.message("warn", "请填写数字！");
				$priorityButton.addClass("disabled");
				isDisabled++;
				return;
			}
		});
		if( isDisabled == 0 ){
			$priorityButton.removeClass("disabled");
		}
		
	})
});
</script>
</head>
<body>
	<div class="path">
		<a href="../right.do">首页</a> &raquo; 栏目列表 <span>(共<span id="pageTotal">${list?size}</span>条记录)</span>
	</div>
	<form id="listForm" action="v_list.do" method="post">
		<input type="hidden" name="root" value="${root!}"/>
		<div class="bar">
			<div class="buttonWrap">
				<@cms_perm url="/channel/o_delete.do">
				<a href="javascript:;" id="deleteButton" class="iconButton disabled">
					<span class="deleteIcon">&nbsp;</span>删除
				</a>
				</@cms_perm>
				
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>刷新
				</a>
				<@cms_perm url="/channel/v_add.do">
				<div class="menuWrap">
					<a href="javascript:;" id="filterSelect" class="button">
						添加子栏目<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="filterOption" class="check">
							<#list modelList as model>
								<li  <#if model_index gt 0 && model_index % 2==0> class="separator"</#if>>
									<a href="v_add.do?modelId=${model.id}&root=${root!}" name="model" val="${model.id}"  target="rightFrame">${model.name}</a>
								</li>	
							</#list>
						</ul>
					</div>
				</div>
				</@cms_perm>
				<@cms_perm url="/channel/o_priority.do">
				<a href="javascript:;" id="priorityButton" class="button">保存顺序</a>
				</@cms_perm>
			</div>
			<div class="menuWrap">
				<div class="search">
					<span id="searchPropertySelect" class="arrow">&nbsp;</span>
					<input type="text" id="searchValue" name="searchValue" value="${searchValue!}" maxlength="200" />
					<button type="submit">&nbsp;</button>
				</div>
				<div class="popupMenu">
					<ul id="searchPropertyOption">
						<li>
							<a href="javascript:;" val="channelExt.name">名称</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<table id="listTable" class="list">
			<tr>
				<th class="check">
					<input type="checkbox" id="selectAll" />
				</th>
				<th>
					<a href="javascript:;" class="sort" name="id">编号</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="channelExt.name">名称</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="path">访问路径</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="priority">排列顺序</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="display">显示</a>
				</th>
				<th>
					<span>操作</span>
				</th>
			</tr>
			<#list list as channel>
			<tr>
				<td><input type="checkbox" name="ids" value="${channel.id}" /></td>
				<td>${channel.id}<input type="hidden" name="wids" value="${channel.id}"/></td>
				<td>${channel.name}</td>
				<td>${channel.path}</td>
				<td>
						<input type="text" class="text" name="priority" value="${channel.priority}" style="width:40px;text-align:center"/>
				</td>
				<td>
					<#if channel.display><span class="trueIcon">&nbsp;</span><#else><span class="falseIcon">&nbsp;</span></#if>
				</td>
				<td>
					<@cms_perm url="/channel/v_edit.do"><a href="v_edit.do?id=${channel.id}" >[<@s.m "global.edit"/>]</a></@cms_perm>
				</td>
				</tr>
			</#list>
		</table>
		<#include "../list_hidden.html"/>
	</form>
</body>
</html>
<#include "/common/alert_message.html"/>
